<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<script>
	$(function() {
		$('#venueMgt_venueInfoMgt_datagrid').datagrid({
			url : 'venueInfoAction!getDatagrid.action',
			fitColumns : false,
			border : false,
			pagination : true,
			pageSize : 20,
			fit : true,
			singleSelect : true,
			rownumbers : true,
			idField : 'pkVenueInfo',
			//sortName : 'name',
			columns : [ [ {
				field : 'pkVenueInfo',
				title : '场馆编号',
				width : 150,
				//hidden : true,
				align : 'center'
			}, {
				field : 'name',
				title : '场馆名',
				width : 150,
				sortable : true,
				align : 'center',
			}, {
				field : 'setupDate',
				title : '设立日期',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'address',
				title : '地址',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'area',
				title : '面积',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'cdatetime',
				title : '创建时间',
				width : 150,
				sortable : true,
				align : 'center'
			}, {
				field : 'mdatetime',
				title : '最后修改时间',
				width : 150,
				sortable : true,
				align : 'center'
			} ] ],

			toolbar : [ {
				iconCls : 'icon-add',
				text : '增加',
				handler : function() {
					$('#venueMgt_venueInfoMgt_addForm').form('clear');
					$('#venueMgt_venueInfoMgt_addDialog').dialog('open');
				}
			}, '-', {
				iconCls : 'icon-edit',
				text : '修改',
				handler : function() {
					venueInfoEdit();

				}
			}, '-', {
				iconCls : 'icon-remove',
				text : '删除',
				handler : function() {
					venueRemove();
				}
			}],
		});
		
		$('#venueMgt_venueInfoMgt_addForm').form({
			url : 'venueInfoAction!add.action',
			success : function(r) {
				var obj = jQuery.parseJSON(r);
				if (obj.success) {
					$('#venueMgt_venueInfoMgt_addDialog').dialog('close');
					$('#venueMgt_venueInfoMgt_datagrid').datagrid('load');
				}
				$.messager.alert({
					title : '提示',
					msg : obj.msg
				});
			}
		});
		
		$('#venueMgt_venueInfoMgt_editForm').form({
			url : 'venueInfoAction!edit.action',
			success : function(r) {
				var obj = jQuery.parseJSON(r);
				if (obj.success) {
					$('#venueMgt_venueInfoMgt_editDialog').dialog('close');
					$('#venueMgt_venueInfoMgt_datagrid').datagrid('load');
				}
				$.messager.alert({
					title : '提示',
					msg : obj.msg
				});
			}
		});
	});
	
	function venueInfoEdit(){
		var row = $('#venueMgt_venueInfoMgt_datagrid').datagrid('getSelected');
		if(row!=null){
			$('#venueMgt_venueInfoMgt_editDialog').dialog('open');
		}
		else{
			$.messager.alert({
				title : '提示',
				msg : '您未选中任何行！'
			});
		}
	};
	function venueOpenEditDialog(){
		var row = $('#venueMgt_venueInfoMgt_datagrid').datagrid('getSelected');
		console.info(row);
		$('#venueMgt_venueInfoMgt_editForm').form('load',row);
	};
	
	function venueRemove(){
		var row = $('#venueMgt_venueInfoMgt_datagrid').datagrid('getSelected');
		console.info(row);
		var id =null;
		if(row.pkVenueInfo!=null){
			id=row.pkVenueInfo;
			$.ajax({
				url:'venueInfoAction!remove.action',
				data:{pkVenueInfo:id},
				dataType:'json',
				success:function(info){
					$('#venueMgt_venueInfoMgt_datagrid').datagrid('reload');
					$('#venueMgt_venueInfoMgt_datagrid').datagrid('clearSelections');
					$.messager.alert({
						title : '提示',
						msg : info.msg
					});
				}
			});
		}else{
			$.messager.alert({
				title : '提示',
				msg : '您未选中任何行！'
			});
		}
	};
	function venueSearchFun() {
		$('#venueMgt_venueInfoMgt_datagrid').datagrid('load', serializeObject($('#venueMgt_venueInfoMgt_searchForm')));
	};
	function venueclearFun() {
		$('#venueMgt_venueInfoMgt_searchForm').form('clear');
		$('#venueMgt_venueInfoMgt_datagrid').datagrid('load', {});
	};
	
</script>

<div class="easyui-panel" data-options="border:false,fit:true">
	<div id="venueMgt_venueInfoMgt_datagrid_panel" class="easyui-panel" data-options="border:false,fit:true,">
		<table id="venueMgt_venueInfoMgt_datagrid"></table>
	</div>
</div>

<div id="venueMgt_venueInfoMgt_addDialog" class="easyui-dialog" style="width: 600px; height: 400px" data-options="iconCls:'icon-add',
		closed:true,
		minimizable:false,
		maximizable:false,
		draggable:false,
		title:' 增加',
		modal:true,
		buttons: [{text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#venueMgt_venueInfoMgt_addDialog').dialog('close');
					}
				},{text:'增加',
					iconCls:'icon-add',
					handler:function(){
						$('#venueMgt_venueInfoMgt_addForm').submit();
					}
				}]
				">
	<form id="venueMgt_venueInfoMgt_addForm" style="margin: 5%">
		<table style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 580px;">
			<label>操作信息</label>
			<hr style="height: 1px; border: none; border-top: 1px solid #D8E6E7;" />
			<tr>
				<td>场馆名</td>
				<td><input class="easyui-textbox" type="text" name="name" data-options="required:true,"></input></td>
				<td>设立日期</td>
				<td><input class="easyui-datebox" type="text" name="setupDate" data-options="required:true,"></input></td>
			</tr>
			<tr>
				<td>地址</td>
				<td><input class="easyui-textbox" type="text" name="address" data-options="required:true," style="width:auto"></input></td>
			</tr>
			<tr>
				<td>面积</td>
				<td><input class="easyui-textbox" type="text" name="area" data-options="required:true,validType:'intOrFloat'"></input></td>
			</tr>
		</table>
		<table cellpadding="10" style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 580px;">
			<label>操作信息</label>
			<hr s style="height: 1px; border: none; border-top: 1px solid #D8E6E7;" />
			<tr>
				<td>创建时间</td>
				<td><input class="easyui-textbox" type="text" name="cdatetime" data-options="readonly:true"></input></td>
				<td>最后修改时间</td>
				<td><input class="easyui-textbox" type="text" name="mdatetime" data-options="readonly:true"></input></td>
			</tr>
		</table>
	</form>
</div>

<div id="venueMgt_venueInfoMgt_editDialog" class="easyui-dialog" style="width: 600px; height: 400px" data-options="iconCls:'edit-add',
		closed:true,
		minimizable:false,
		maximizable:false,
		draggable:false,
		title:' 修改',
		modal:true,
		buttons: [{text:'取消',
					iconCls:'icon-cancel',
					handler:function(){
						$('#venueMgt_venueInfoMgt_editDialog').dialog('close');
					}
				},{text:'修改',
					iconCls:'icon-add',
					handler:function(){
						$('#venueMgt_venueInfoMgt_editForm').submit();
					}
				}],
				onOpen:function(){
					venueOpenEditDialog();
				}
				">
	<form id="venueMgt_venueInfoMgt_editForm" style="margin: 5%">
		<table cellpadding="10" style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 580px;">
			<label>操作信息</label>
			<hr s style="height: 1px; border: none; border-top: 1px solid #D8E6E7;" />
			<tr>
				<td>场馆名</td>
				<td><input class="easyui-textbox" type="text" name="name" data-options="required:true,readonly:true"></input></td>
				<td>场馆编号</td>
				<td><input class="easyui-textbox" type="text" name="pkVenueInfo" data-options="required:true,readonly:true"></input></td>
				
				</tr>
			<tr>
				<td>设立日期</td>
				<td><input class="easyui-datebox" type="text" name="setupDate" data-options="required:true,required:true,readonly:true"></input></td>
			
				<td>地址</td>
				<td><input class="easyui-textbox" type="text" name="address" data-options="required:true," style="width:auto"></input></td>
			</tr>
			<tr>
				<td>面积</td>
				<td><input class="easyui-textbox" type="text" name="area" data-options="required:true,validType:'intOrFloat'"></input></td>
			</tr>
		</table>
		<table cellpadding="10" style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 580px;">
			<label>操作信息</label>
			<hr s style="height: 1px; border: none; border-top: 1px solid #D8E6E7;" />
			<tr>
				<td>创建时间</td>
				<td><input class="easyui-textbox" type="text" name="cdatetime" data-options="readonly:true"></input></td>
				<td>最后修改时间</td>
				<td><input class="easyui-textbox" type="text" name="mdatetime" data-options="readonly:true"></input></td>
			</tr>
		</table>
	</form>
</div>


<div id="venueMgt_venueInfoMgt_searchDialog" class="easyui-dialog" title="查询" style="width: 600px; height: 300px" data-options="iconCls:'icon-search',modal:true,closed:true,collapsible:false,minimizable:false,maximizable:false,
		buttons: [{text:'重置查询结果',
					iconCls:'icon-reload',
					handler:function(){
						venueclearFun();
						$('#venueMgt_venueInfoMgt_searchDialog').dialog('close');
					}
				},
		{text:'重置查询条件',
					iconCls:'icon-redo',
					handler:function(){
						$('#venueMgt_venueInfoMgt_searchForm').form('clear');
					}
				},{text:'查询',
					iconCls:'icon-search',
					handler:function(){	
						venueSearchFun();
						$('#venueMgt_venueInfoMgt_searchDialog').dialog('close');
					}
				}]">

	<form id="venueMgt_venueInfoMgt_searchForm" style="margin: 5%">
	<table style="margin-top: 15px;border-collapse: separate; border-spacing: 15px; width: 580px;">
			<tr>
				<td>标题</td>
				<td><input class="easyui-textbox" type="text" name="text" data-options=""></input></td>
				<td>父标题</td>
				<td><input class="easyui-textbox" type="text" name="parent_name" data-options=""></input></td>
			</tr>
			</table>
	</form>
</div>